<script type="text/javascript">
	var setting = {
		view: {
			dblClickExpand: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick
		}
	};
	var zNodes =[
		{ id:'0', pId:0, name:"公共文件夹", open:true, icon:"/assets/images/icon-file-closed.png",click:"loadURL('/${orgi}/design/query/loadreport/0.html','#reportlist',function(){hideMenu();})"}
		<#if reportDicList??>
		<#list reportDicList as reportDic>
		,{ id:"${reportDic.id!''}", pId:"${reportDic.parentid!''}", name:"${reportDic.name!''}", icon:"/assets/images/icon-file-closed.png",click:"loadURL('/${orgi}/design/query/loadreport/${reportDic.id!''}.html','#reportlist',function(){hideMenu();})"}
		</#list>
		</#if>
	 ];
	 $(document).ready(function(){
		$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		<#if drill??>
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			var nodes = zTree.getNodesByParam("id", "${drill.reportdicid!'0'}", null);
			zTree.selectNode(nodes[0]);
			var cityObj = $("#dicinput");
			cityObj.val(nodes[0].name);
			$("#reportdicid").val(nodes[0].id);
		</#if>
		
	});

	function onClick(e, treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
		nodes = zTree.getSelectedNodes();
		
		var cityObj = $("#dicinput");
		cityObj.val(nodes[0].name);
		$("#reportdicid").val(nodes[0].id);
	}

	function showMenu() {
		var cityObj = $("#reportdic");
		var cityOffset = $("#reportdic").position();
		$("#menuContent").css({left:cityOffset.left+"px", top:(cityOffset.top+27)+"px"}).show();

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").hide();
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}
	function loadReportFilter(obj){
		if($(obj).val()=='noparam'){
			$('#selectedvaluediv').hide();
			$('#selectedvaluediv').html("");
		}else{
			if($("select[name='reportid']").val()!=""){
				$('#selectedvaluediv').show();
				loadURLWithTip("/${orgi}/design/query/"+$("select[name='reportid']").val()+"/${report.id!''}/${reportModel.id!''}/selectFilter.html" , "#selectedvaluediv" , null  , true);
			}else{
				$(obj).val("noparam");
			}
			
		}
			
	}
	function resetstate(){
		$("#paramtype").val("noparam");
		loadReportFilter("#paramtype");
	}
</script>
<div id="menuContent" class="menuContent" style="z-index:2000; display:none; position: absolute;border: 1px solid #09f;width:183px;overflow:auto;;background-color:#FFFFFF;height:150px;">
	<ul id="treeDemo" class="ztree"></ul>
</div>
<form action="/${orgi}/design/query/drilldefdo/${report.id!''}/${reportModel.id!''}.html" data-toggle="ajax-form" data-target="#design_table" method="post" id="mainForm">
<input type="hidden" id="modelid" name="modelid" value="${reportModel.id!''}">
<input type="hidden" id="dataname" name="dataname" value="${col!''}">
<input type="hidden" id="drillpos" name="drillpos" value="${type!''}">
<div class="artCon">
	<div class="middleArt">
		<div class="artMain artOther">
			<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
				<div class="span2"><h3>钻取列：</h3></div>
				<div class="span4" style="line-height:23px;">${col!''}</div>
				<div class="span1"><h3 style="line-height:23px;">定义：</h3></div>
				<div class="span4" style="display:inline-flex;padding-left:0px;">
					<input type="radio" value="true" name="enable" id="enb" <#if !drill?? || (drill?? && drill.enable == true)>checked="checked"</#if>><label for="enb">启用</label>
					<input type="radio" value="false" name="enable" id="uenb" <#if drill?? && drill.enable == false>checked="checked"</#if>><label for="uenb">禁用</label>
					<!--
					<input type="radio" value="def" name="coltype" id="other" onclick="$('#drillurl').hide();"><label for="other">到其他报表</label>
					-->
				</div>
			</div>
			<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
				<div class="span2"><h3 style="line-height:23px;">钻取类型：</h3></div>
				<div class="span5" style="display:inline-flex;padding-left:0px;">
					<label><input type="radio" value="url" name="drilltype" id="url"  onclick="$('#drillurl').show();$('#reportdrill').hide();" <#if !drill?? || (drill?? && drill.drilltype == 'url')>checked="checked"</#if>>页面跳转</label>
					<label><input type="radio" value="detail" name="drilltype" id="detail" onclick="$('#drillurl').hide();$('#reportdrill').hide();" <#if drill?? && drill.drilltype == 'detail'>checked="checked"</#if>>到明细</label>
					</label>
					<label><input type="radio" value="def" name="drilltype" id="other" onclick="$('#drillurl').hide();$('#reportdrill').show();" <#if drill?? && drill.drilltype == 'def'>checked="checked"</#if>>到其他报表</label>
				</div>
			</div>
			<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;<#if drill?? && drill.drilltype != 'url'>display:none;</#if>" id="drillurl">
				<div class="span2"><h3>跳转URL：</h3></div>
				<div class="span8">
					<input type="text" value="<#if drill??>${drill.paramurl!''}</#if>" name="paramurl" style="width:415px;">
				</div>
			</div>
			<div class="row-fluid" id="reportdrill" style="<#if !drill??||(drill?? && drill.drilltype != 'def')>display:none;</#if>">
				<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
					<input type="hidden" value="0" id="reportdicid" name="reportdicid">
					<div class="span2"><h3>跳转报表目录：</h3></div>
					<div class="span4">
						<div class="input_wrap" id="reportdic">
							<img src="/assets/images/ctr-icons-13.png" height="16">
							<input id="dicinput" type="text" value="公共文件夹" class="txt_1 txt" onclick="showMenu(this)" readonly="readOnly" style="width:130px;border: 1px solid #09f;"> 
							<a href="javascript:showMenu(this)" id="cubelist"><i class="selectIco"></i> </a> 
							
						</div>
					</div>
					<div class="span2"><h3>选择报表：</h3></div>
					<div class="span3" id="reportlist">
						<#include "loadreport.html"/> 
					</div>
				</div>
				<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
					<div id="format" class="row-fluid">
						<div class="span2"><h3>传递参数：</h3></div>
						<div class="span2">
							<select name="paramtype" id="paramtype" onchange="loadReportFilter(this)">
								<option value="noparam" <#if drill?? && drill.paramtype == 'noparam'>selected="selected"</#if>>不使用参数</option>
								<option value="paramvalue" <#if drill?? && drill.paramtype == 'paramvalue'>selected="selected"</#if>>传递参数值</option>
							</select>
						</div>
					</div>
					<div id="selectedvaluediv" class="tableScrollWrap" style=" <#if !drill??||(drill?? && drill.paramtype == 'noparam')>display:none;</#if>width:95%;max-height: 100px;">
						<#include "selectFilters.html"/> 
					</div>
				</div>
				<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
					<div id="format" class="row-fluid">
						<div class="span2"><h3>自定义参数：</h3></div>
						<div class="span7">
							<input type="text" value="<#if drill??>${drill.paramvalue!''}</#if>" name="paramvalue" style="width:358px;">
						</div>
					</div>
				</div>
				<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
					<div id="format" class="row-fluid">
						<div class="span2"><h3>跳转阀值：</h3></div>
						<div class="span7">
							<input type="text" value="<#if drill??>${drill.gotomaxvalue!''}</#if>" name="gotomaxvalue" style="width:358px;">
						</div>
					</div>
				</div>
				<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;display:none;">
					<!--
					<div id="dimparam" class="row-fluid">
						<div class="span2"><h3>可选参数列表：</h3></div>
						<div class="span4">
							<select name="paramtype">
								<option value="sum" <#if drill?? && drill.paramtype == 'sum'>selected="selected"</#if>>不使用参数</option>
								<option value="avg" <#if drill?? && drill.paramtype == 'avg'>selected="selected"</#if>>传递数据项</option>
								<option value="max" <#if drill?? && drill.paramtype == 'max'>selected="selected"</#if>>传递参数值</option>
								<option value="min" <#if drill?? && drill.paramtype == 'min'>selected="selected"</#if>>自定义</option> 
							</select>
						</div>

						<div class="span2"><h3>参数值选项：</h3></div>
						<div class="span4">
							<select name="paramtype">
								<option value="sum" <#if drill?? && drill.paramtype == 'sum'>selected="selected"</#if>>不使用参数</option>
								<option value="avg" <#if drill?? && drill.paramtype == 'avg'>selected="selected"</#if>>传递数据项</option>
								<option value="max" <#if drill?? && drill.paramtype == 'max'>selected="selected"</#if>>传递参数值</option>
								<option value="min" <#if drill?? && drill.paramtype == 'min'>selected="selected"</#if>>自定义</option> 
							</select>
						</div>
					</div>
					-->
				</div>
			</div>
			<div class="mainTop row-fluid" style="padding-bottom:0px;padding:0px 0 0px 10px;">
				<div class="span2"><h3>目标格式：</h3></div>
				<div class="span4">
					<select name="targetmime">
						<option selected="selected" value="HTML" <#if drill?? && drill.targetmime == 'HTML'>selected="selected"</#if>>HTML</option>
						<option value="Excel" <#if drill?? && drill.targetmime == 'Excel'>selected="selected"</#if>>Excel</option>
						<option value="CSV" <#if drill?? && drill.targetmime == 'CSV'>selected="selected"</#if>>CSV</option>
						<option value="PDF" <#if drill?? && drill.targetmime == 'PDF'>selected="selected"</#if>>PDF</option>
					</select>
				</div>
				<div class="span5">
					<h3>
						<label>
							<input type="checkbox" name="paramtarget" value="_blank" <#if !drill?? || (drill?? && drill.paramtarget == '_blank')>checked="checked"</#if>/>在新窗口中打开
						</label>
					</h3>
				</div>
			</div> 			
		</div>
		<div class="bottomBg">
			<div class="btnWrap">
				<input type="submit" class="subButtonStyle" value="确认"/>
				<input type="button" onclick="closeR3ArtDialog()" class="cancelButtonStyle" value="取消"/>
			</div>
		</div>
	</div>
</div>
</form>